package per.ace.exception.web;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import per.ace.exception.common.R;
import per.ace.exception.entity.Order;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @program: springbootDemo
 * @description: 测试 控制层 返回
 * @author: ace
 * @Date: 2020-08-06 11:22
 */
@RestController
@RequestMapping("/api/v1/users")
public class TestController {

    @GetMapping
    public R list() {
        List list = new ArrayList<>();
        list.add(new Order(1L,"aaa"));
        list.add(new Order(2L,"bbb"));
        list.add(new Order(3L,"ccc"));
        list.add(new Order(4L,"ddd"));
        list.add(new Order(5L,"eee"));

        Map map = new HashMap();
        System.out.println(map.get("name").toString());
        return R.ok().data("order", list).message("订单列表");
    }
}
